<%@ page import="java.util.List" %>
<%@ page import="java.util.ArrayList" %>
<%@ page import="com.foreknow.bean.Guest" %><%--
  Created by IntelliJ IDEA.
  User: 24528
  Date: 2022/7/12
  Time: 11:28
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
    <meta name="description" content="">
    <meta name="author" content="">
    <link rel="icon" href="https://cdn.jsdelivr.cn/npm/@bootcss/v3.bootcss.com@1.0.43/favicon.ico">
    <link rel="canonical" href="https://getbootstrap.com/docs/3.4/examples/signin/">

    <!-- Bootstrap core CSS -->
    <link href="./css/bootstrap.min.css" rel="stylesheet">

    <!-- Custom styles for this template -->
    <link href="./css/signin.css" rel="stylesheet">

    <!-- Just for debugging purposes. Don't actually copy these 2 lines! -->
    <!--[if lt IE 9]><script src="https://cdn.jsdelivr.cn/npm/@bootcss/v3.bootcss.com@1.0.43/assets/js/ie8-responsive-file-warning.js"></script><![endif]-->
    <!-- <script src="https://cdn.jsdelivr.cn/npm/@bootcss/v3.bootcss.com@1.0.43/assets/js/ie-emulation-modes-warning.js"></script> -->

    <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
    <!--[if lt IE 9]>
    <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
    <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
    <![endif]-->
    <title>查询</title>
    <link rel="stylesheet" href="./css/bootstrap.css">
</head>
<body>

<div class="container">
    username: ${username};
    <table class="table table-hover">
        <a href="/WebDemo_war_exploded/guestManager?q=add" class="btn btn-primary btn-lg active">添加</a>
        <tr>
            <td>编号</td>
            <td>姓名</td>
            <td>电话号码</td>
            <td>邮箱</td>
            <td>标题</td>
            <td>内容</td>
            <td>创建时间</td>
            <td>操作</td>
        </tr>
        <%
            //可以写Java代码
            //List list = new ArrayList();
//            List<Object> list = (List<Object>) request.getAttribute("list");
//            for (int i = 0;i<list.size();i++){
//                Guest guest = (Guest) list.get(i);
        %>
        <c:forEach var="guest" items="${list}">
        <tr>
            <td>${guest.id}</td>
            <td>${guest.name}</td>
            <td>${guest.phone}</td>
            <td>${guest.email}</td>
            <td>${guest.title}</td>
            <td>${guest.content}</td>
            <td>${guest.createdtime}</td>
            <td>
                <a href="/WebDemo_war_exploded/guestManager?id=${guest.id}&q=update" class="btn btn-primary btn-lg active">编辑</a>
                <a href="/WebDemo_war_exploded/guestManager?id=${guest.id}&q=delete" class="btn btn-danger btn-lg active">删除</a>
            </td>
        </tr>
        </c:forEach>
        <%
//            }
        %>
    </table>

</div>
</body>
</html>
